<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SpringMVC_demo</title>
<link rel="stylesheet" type="text/css" href="<%=path%>/css/common.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/themes/icon.css" />
<script type="text/javascript" src="<%=path%>/js/jquery.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/easyui-lang-zh_CN.js"></script>

<script type="text/javascript">
function showDialog(){
	$('#dialog_login').dialog({
	    title: '用户登录',
	    cache: false,
	    modal: true
	});
	$('#dialog_login').dialog('open');
}

function login(){
	var options = {
		success: function (data){
        	if($.parseJSON(data).result == 'success'){
        		window.location.href = '<%=path %>/common/toMain.do';
        	}else{
        		$.messager.alert('温馨提示','用户名或密码错误！', 'info');
        	}
        },
		error:function(){
			$.messager.alert('温馨提示','操作失败！', 'error');
		}
	};
	$('#loginForm').form('submit', options);
}
</script>
</head>
<body>
	<img src="<%=path %>/images/background.gif" width="100%" height="100%" alt="点击任意开登录" title="点击任意开始登录" onclick="showDialog();">
	<div id="dialog_login" class="easyui-dialog" data-options="iconCls:'icon-man',closed: true">
		<form id="loginForm" action="<%=path %>/common/login.do" method="POST">
		<table id="__01" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td colspan="4">
					<img src="<%=path %>/images/2_01.jpg" width="334" height="63" alt=""></td>
			</tr>
			<tr>
				<td rowspan="6">
					<img src="<%=path %>/images/2_02.jpg" width="33" height="254" alt=""></td>
				<td colspan="2">
					<input type="text" id="userName" name="userName"
						style="background-image: url('<%=path %>/images/2_03.jpg'); width: 265px; height: 42px; border: 0px;"
						class="easyui-validatebox" data-options="required:true,validType:'length[6,20]'"
						missingMessage="用户名必须填写" invalidMessage="用户名长度应介于6和20之间"
						onkeyup="value=value.replace(/[^\w\/]/ig,'')"/>
				</td>
				<td rowspan="6">
					<img src="<%=path %>/images/2_04.jpg" width="36" height="254" alt=""></td>
			</tr>
			<tr>
				<td colspan="2">
					<img src="<%=path %>/images/2_05.jpg" width="265" height="44" alt=""></td>
			</tr>
			<tr>
				<td colspan="2">
					<input type="password" id="password" name="password"
						style="background-image: url('<%=path %>/images/2_06.jpg'); width: 265px; height: 46px; border: 0px;" 
						class="easyui-validatebox" data-options="required:true" missingMessage="密码必须填写"/>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<img src="<%=path %>/images/2_07.jpg" width="265" height="51" alt=""></td>
			</tr>
			<tr>
				<td rowspan="2">
					<img src="<%=path %>/images/2_08.jpg" width="170" height="67" alt=""></td>
				<td>
					<a href="javascript:void(0)" name="login" onclick="login();" >
						<img alt="login" src="<%=path %>/images/2_09.jpg">
					</a>
				</td>
			</tr>
			<tr>
				<td>
					<img src="<%=path %>/images/2_10.jpg" width="95" height="30" alt=""></td>
			</tr>
		</table>
		</form>
	</div>
</body>
</html>

